﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.EquipmentManagement;
using Digitalmes.Model.WmsManagement;

namespace Digitalmes.Model.EquipmentManagement
{
    /// <summary>
    /// 耗材模型
    /// </summary>
	[Table("ConsumableUsage")]

    [Display(Name = "_Model.ConsumableUsage")]
    public class ConsumableUsage : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._ConsumableUsage._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._ConsumableUsage._Record")]
        [Comment("关联维护记录")]
        public MaintenanceRecord Record { get; set; }
        [Display(Name = "_Model._ConsumableUsage._Record")]
        [Comment("关联维护记录")]
        public long? RecordId { get; set; }
        [Display(Name = "_Model._ConsumableUsage._MaterialId")]
        [Comment("耗材名称")]
        public long? MaterialId { get; set; }

        public MaterialDoc Material { get; set; }   

        [Display(Name = "_Model._ConsumableUsage._MaterialName")]
        [Comment("耗材名称")]
        public string MaterialName { get; set; }
        [Display(Name = "_Model._ConsumableUsage._Specification")]
        [Comment("规格")]
        public string Specification { get; set; }
        [Display(Name = "_Model._ConsumableUsage._Quantity")]
        [Comment("数量")]
        [Precision(18,2)]
        public decimal? Quantity { get; set; }
        [Display(Name = "_Model._ConsumableUsage._Unit")]
        [Comment("单位")]
        public string Unit { get; set; }
        [Display(Name = "_Model._ConsumableUsage._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
